#pragma once
#include "..\ConfigManage\ITaskEvent.h"

#define WM_DOWNLOADPROGRESS_MESSAGE      WM_USER + 10000
#define WM_DOWNLOADERROR_MESSAGE         WM_USER + 10001
#define WM_SETUPCOMPLETE_MESSAGE         WM_USER + 10002
#define WM_DOWNLOADCOMPLETE_MESSAGE      WM_USER + 10004

typedef struct tagDOWNLOADPROGRESS
{
	tagDOWNLOADPROGRESS()
	{
		strTaskNo = L"";
		dwTotalSize = 0;
		dwLength = 0;
	}
	~tagDOWNLOADPROGRESS()
	{
		dwTotalSize = 0;
		dwLength = 0;
	}
	CStdString strTaskNo;
	long long dwLength;
	long long dwTotalSize;
}DOWNLOADPROGRESS;

typedef struct tagDOWNLOADERROR
{
	tagDOWNLOADERROR()
	{
		strTaskNo = L"";
		dwCode = 0;
		memset(szError,0x0,MAX_PATH);
	}

	~tagDOWNLOADERROR()
	{
		strTaskNo = L"";
		dwCode = 0;
		memset(szError,0x0,MAX_PATH);
	}
	CStdString strTaskNo;
	DWORD dwCode;
	TCHAR szError[MAX_PATH];
}DOWNLOADERROR;

typedef struct tagSETUPCOMPLETE
{
	tagSETUPCOMPLETE()
	{
		strTaskNo = L"";
		bSuccessed = FALSE;
	}
	~tagSETUPCOMPLETE()
	{
		strTaskNo = L"";
		bSuccessed = FALSE;
	}
	CStdString strTaskNo;
	BOOL bSuccessed;
}SETUPCOMPLETE;

typedef struct tagDOWNLOADCOMPLETE
{
	tagDOWNLOADCOMPLETE()
	{
		strTaskNo = L"";
		bSuccessed = FALSE;
	}
	~tagDOWNLOADCOMPLETE()
	{
		strTaskNo = L"";
		bSuccessed = FALSE;
	}
	CStdString strTaskNo;
	BOOL bSuccessed;
}DOWNLOADCOMPLETE;

class CMaterialDownloadEvent:public ITaskEvent
{
public:
	CMaterialDownloadEvent(void);
	virtual ~CMaterialDownloadEvent(void);
	void OnErrorCallBack(CStdString strTaskNo,DWORD dwCode, LPCTSTR lpError);
	void OnProcessCallBack(CStdString strTaskNo,long long dwLength, long long dwTotalSize);
	void OnSetupCompleteCallBack(CStdString strTaskNo,BOOL bSuccessed);
	void OnDownloadComplete(CStdString strTaskNo,BOOL bSuccessed);
	void SetHwndParent(HWND hWnd);
private:
	HWND m_hWndParent;
};
